Integration Guide Techman BPS 1.12

This guide describes how to integrate Techman robots with Bin Picking Studio (BPS) 1.12.

1. Prerequisites

Before you start, make sure that your robot controller meets these requirements:

  • Control box hardware version v3.2 or v5

  • System version 2.24 or higher (older versions are not supported)

This version of the Robot module was developed on a Techman TM12S with system version 2.24.

To check the system version of your robot, go to the top right corner of the TMflow screen:

Figure 1

The Techman system version is on the first line:

Figure 2

You also need the TMflow SW on your PC, preferably version 2.24 or higher.

Figure 3

The robot firmware and TMflow are free to download from the Techman download center.

The Robot module (Photoneo_BPS_Module_1_12_0.zip) contains:

  • Bin Picking Client Scripts/ - photoneo_main_bps.script (communication backend + default MAIN PROGRAM) and the example scripts listed in section 3.8

  • State Server TMCraft Service/TMserver_PHO_8ABBA73E.zip - the Robot State Server (TMCraft service)

  • README.md, CHANGELOG.md, the integration guide and the cheat sheet (PDF)

2. Robot Controller Setup

2.1 Initial Setup and Configuration

Figure 4

To start the commissioning, first connect directly to the robot controller. Connect an HDMI monitor, a USB keyboard and a mouse to the ports on the control box. With this local interface, you can see the current system configuration and make the first changes. The most important one is the network setup. This manual uses the TMflow software for all later commissioning steps. However, you must first set the IP address of the controller through this direct connection.

Figure 5

With an external monitor, keyboard and mouse, you have direct console access to the operating system of the robot. You need this access to set the network parameters for the remote connection from TMflow on your PC.

2.2 Network Configuration

The Techman control box has several Ethernet ports. You can use any of them for the communication. This manual uses Port 2 for the communication with the Photoneo vision controller.

To change the IP configuration, click Menu -> Settings -> System -> Network.

Figure 6

Select Static IP Address as the network method and enter the IP address and the subnet mask of the robot controller. This manual uses IP address 192.168.1.2 and subnet mask 255.255.255.0.

Figure 7

Click the Save button to confirm the changes.

Note

The subnet mask 255.255.255.0 is the same as a 24-bit subnet mask (/24). For other combinations, see this table: https://dnsmadeeasy.com/support/subnet

Example of a matching network configuration on the vision controller side:

  • Vision controller IPv4 address: 192.168.1.1 / 24

  • Robot controller IPv4 address: 192.168.1.2 / 24 (as configured in the previous step)

Figure 8

You can also use the Test Connection button on the Network page of the vision controller to ping the Techman robot controller.

Figure 9

Based on the result of the test (ping command), a Robot Available or Robot Unavailable message is shown. If the robot is unavailable, check the cables and the network configuration.

Figure 10

2.3 Second Network Interface for TMflow

We recommend that you configure a second Ethernet port for remote access from TMflow on a PC. This manual uses Port 1 for this. To prevent network conflicts, give this port a static IP address on a different subnet than the one used for the connection to the vision controller.

Example of a valid configuration for Port 1:

  • IP Address: 192.168.100.1

  • Subnet Mask: 255.255.255.0

Figure 11

Before you connect to the real robot from TMflow on your PC, set the IPv4 address of the Ethernet port of your PC. It must be on the same subnet as the Techman port, but with a different IP address.

Example IPv4 configuration of the PC with TMflow: 192.168.100.2 / 255.255.255.0

2.4 Installing the Robot State Server

The Robot State Server is an essential component. It provides real-time robot state data for calibration and for 3D visualization. On Techman robots, the Robot State Server is a custom TMCraft service. It is in the module folder State Server TMCraft Service/ as TMserver_PHO_8ABBA73E.zip. The service runs independently of the TMscript program. After you enable it, it starts automatically with the controller. To install it, follow these steps.

Warning

Before you import the Robot State Server zip file, make sure that the TMCraft service and Modbus Slave are enabled on the robot.

  1. Copy TMserver_PHO_8ABBA73E.zip from the Photoneo Techman module to a USB flash drive named TMROBOT.

  2. Plug the USB flash drive into one of the USB ports of the robot controller.

  3. Go to Settings -> System -> Import/Export and select the Import option.

Figure 12
  1. Select TMserver_PHO_8ABBA73E.zip from the list and import the file.

  2. Go to TMCraft service and enable TMserver_PHO_8ABBA73E.

Figure 13
  1. Restart the robot controller to apply the settings. The service starts automatically after the boot.

After the restart, the Robot State Server on the Techman controller is ready and listens for client connections on TCP port 11004. Before you can see the robot state, configure the tool point.

Figure 14

2.5 Tool TCP Setup

Bin Picking Studio works with a Tool Center Point (TCP) that is zero relative to the robot flange. On Techman robots, this is the default “0 Robot End Flange” tool. You do not need to define TCP offsets on the robot controller, because Bin Picking Studio calculates and compensates for them internally. You can still define a custom TCP if other parts of your robot program need it. This manual uses one CustomTool with a Z offset of 205 mm.

Figure 15

Use the ChangeTCP TMscript command whenever you need to force the correct tool frame. For example, scan and calibration requests always need “0 RobotEndFlange”. When you pick based on the Get Object Pose result, select “1 Custom Tool”. When you pick with the Trajectory request, the tool setting does not matter. The trajectories are joint-based and BPS compensates for the TCP.

2.6 Robot State Server and Robot Pose Visualization

When the TMCraft service on the Techman robot is enabled, Bin Picking Studio connects to port 11004. It reads the current joint positions and the Cartesian tool pose of the robot. The joint positions are used to show the robot. The Cartesian TCP data are needed for calibration and for all hand-eye scan requests. The image below shows the real robot pose on the Environment page:

Figure 16

When the Robot State Client is connected to the robot, the robot streams the current joint and tool data to Bin Picking Studio at 10 Hz. The robot pose on the Environment page and the calibration should now work.

To check that the correct zero tool pose is reported, start the calibration, switch from the Texture tab to the Verification tab and enable Tool Pose (robot controller) in the Axis menu. The frame marker should be in the center of the flange, with the Z axis pointing down. It should be identical to the Tool0 (robot model) frame.

Figure 17

2.7 Connecting to the Robot from TMflow

For the next configuration steps, we recommend a remote connection from a PC to the robot controller with TMflow. Use the second Ethernet port configured in section 2.3 to start a TMflow session.

Start TMflow on your PC and select one of the robot models (for example TM12S) to enter the simulation environment. From the simulation, you can then switch to a live connection with the real robot. The figure below shows the connection procedure.

Figure 18

In the list of found devices, select the robot by its IP address and click the “Connect” button. TMflow opens a live control session with the robot, and you have full access to the system.

2.8 Switching from Auto to Manual Mode

Before you change any program or configuration, switch the robot from “Auto” to “Manual” mode. Use this procedure on the Robot Stick:

  • Press and hold the M/A button until it beeps and the LED indicator starts flashing white.

  • Press this sequence: + , - , + , + , -

  • Press the M/A button again to switch to Manual mode. The LED indicator should start flashing green.

  • Press the M/A button once more to lock Manual mode. The LED indicator should stay solid green.

Figure 19

2.9 Using the Photoneo Main Script and Example Programs

The Techman robot controller can run only one script. Because of this, the Photoneo Robot module is one script that combines the ‘user frontend’ and the ‘communication backend’. This file, photoneo_main_bps.script, is the main script. Copy it to the robot as the first step of the installation.

Figure 20

Open photoneo_main_bps.script in a text editor on your PC. To copy the code to the Techman robot, open TMflow, go to Project, start a new project and select New Script (not New Flow):

Figure 21

Copy the entire code from photoneo_main_bps.script and paste it into the TMflow script:

Figure 22

photoneo_main_bps.script contains a basic bin picking sequence. It shows the essential workflow: connect to Bin Picking Studio, trigger a scan, request a trajectory and execute the pick-and-place operation.

You can easily modify photoneo_main_bps.script: replace the MAIN PROGRAM section of the code with the MAIN PROGRAM section of another example script from the module.

Example - to test the “Reuse Scan” feature, open the photoneo_reuse_scan.script file. Copy its entire MAIN PROGRAM block and paste it over the old MAIN PROGRAM block in your project.

Important: The example programs work immediately, but the feature that you want to use must first be set up and active in Bin Picking Studio. For example, to test the Change Bounding Box function, your solution needs at least 2 bounding boxes.

3. Robot Module

Note

We strongly recommend that you read the Photoneo robotic API before this section.

3.1 Connection to Photoneo Vision Controller

Note

The communication backend thread connects to the Action Request Server on the vision controller automatically when it starts. Two global constants are important for this step:

PHOTONEO_VC_ROBOT_PORT_IP - IP address of port on vision controller side
PHOTONEO_PORT_NUM - Port number used by Action Server (by default 11003)

Set PHOTONEO_VC_ROBOT_PORT_IP to the IP address of your vision controller. In this manual, it is 192.168.1.1.

Figure 23

You can send requests to the vision controller only after the connection is established. When the program on the Techman controller starts and connects, the Deployment page shows green Connected indicators (see the image below):

Figure 24

3.2 Request List

This section describes the API calls of the Robot module. Use these procedures for high-level control of the bin picking application. Each procedure passes the request to the communication backend thread, waits for the response and returns the error code (also stored in g_error_code). 0 means success. For the meaning of each request, see Action requests.

Note

These procedures are part of the communication backend. Do not edit them.

Request

ID

Script definition

Input

Populates

Communication Check

100

int comm_check_request()

None

g_error_code

Calibration Start

25

int calib_start(int solution_id, int vision_system_id)

solution_id, vision_system_id

g_error_code

Calibration Add Point

5

int calib_add()

None (the Studio reads the robot pose from the Robot State Server)

g_error_code

Calibration Save

27

int calib_save()

None

g_error_code, g_calib_err, cal_pose_cart

Calibration Stop

26

int calib_stop()

None

g_error_code

Initialize

4

int init_request(int vision_system_id)

vision_system_id, global TPoints start and end (joint values)

g_error_code

Scan Regular

1

int scan_request(int vision_system_id)

vision_system_id

g_error_code

Scan Meshing (Capture)

28

int capture_request(int vision_system_id)

vision_system_id, globals g_mesh_dynamic (0 = static, 1 = dynamic) and g_capture_gap (ms); the current robot pose is sent with each capture

g_error_code

Reuse Scan

29

int reuse_scan_request(int vision_system_id)

vision_system_id

g_error_code

Trajectory

2

int trajectory_request(int vision_system_id)

vision_system_id

g_error_code, trajectory data (file trajectory.txt, g_trajectory_size), Info data (g_tool_point_inv, g_gripping_point_id, g_gripping_point_inv, g_dim_x, g_dim_y, g_rot_z, g_nn_label, g_max_z_height, g_tilt)

Get Object Cartesian Pose

8

int get_object_pose(int vision_system_id, float approach_x_offset, float approach_y_offset, float approach_z_offset)

vision_system_id, approach offsets in mm (added to the object pose in the robot base frame)

g_error_code, obj_pose_cart, obj_pose_cart_approach

Pick Failed

7

int pick_failed_request(int vision_system_id)

vision_system_id

g_error_code

Get Vision System Status

21

int get_status(int vision_system_id)

vision_system_id

g_error_code, g_num_of_localized, g_num_of_planned, g_vs_status

Change Environment Scene

15

int environment_change(int environment_id)

environment_id

g_error_code

Change Solution

9

int solution_change(int solution_id)

solution_id

g_error_code

Start Solution

10

int solution_start(int solution_id)

solution_id

g_error_code

Stop Solution

11

int solution_stop()

None

g_error_code

Get Running Solution

12

int get_running_sol()

None

g_error_code, g_running_sol

Change Bounding Box

32

int bbox_change(int vision_system_id, int bbox_id)

vision_system_id, bbox_id

g_error_code

The Bin Locator request (3) is not implemented. bin_locator_request() always returns 1.

3.3 Info data

Info data are extra values sent with some responses. Each value has a key (op_num). The backend reads the key and stores the value in the matching global variable below. A variable keeps the value from the last response that contained it. Use the values only if the request returned 0. See Info data for the meaning of each key and for the requests that send it.

Key

Info data

Variable

Unit in robot

1

Tool point invariance

g_tool_point_inv

index

2

Gripping point ID

g_gripping_point_id

index

3

Gripping point invariance

g_gripping_point_inv

index

4

Dimension X

g_dim_x

mm

5

Dimension Y

g_dim_y

mm

6

Rotation Z

g_rot_z

rad (received value / 1000)

7

NN label

g_nn_label

integer

8

Max Z height

g_max_z_height

mm

9

Tilt

g_tilt

rad (received value / 1000)

10

Calibration accuracy

g_calib_err

mm (received value / 1000)

11

Running solution ID

g_running_sol

integer

12

Number of localized objects

g_num_of_localized

integer

13

Number of pickable (planned) objects

g_num_of_planned

integer

14

Vision system still processing

g_vs_status

0 = finished, 1 = running

Unknown keys are read and ignored.

3.4 Global variables

Besides the Info data variables, the module uses these global variables and points (declared in the define section of photoneo_main_bps.script):

Name

Type

Purpose

PHOTONEO_VC_ROBOT_PORT_IP, PHOTONEO_PORT_NUM

string, int

Vision controller IP address and port (default 192.168.1.1, 11003)

g_error_code

int

Error code of the last request (0 = no error)

g_mesh_dynamic

int

Capture mode for capture_request(): 0 = static (default), 1 = dynamic meshing

g_capture_gap

int

Delay between dynamic captures in ms (default 500)

g_calib_err

float

Calibration accuracy from calib_save() in mm

g_cal_x_pos … g_cal_z_rot, cal_pose_cart

float, TPoint

Calibration result pose from calib_save() (mm, deg)

g_x_pos … g_z_rot

float

Object pose from get_object_pose() (mm, deg)

obj_pose_cart, obj_pose_cart_approach

TPoint

Object pose and approach pose from get_object_pose()

scan, drop_up, drop_down

TPoint

Scan pose and placing poses used by the example programs

start, end

TPoint

Start and End pose sent by init_request(). Copy start_vs_N / end_vs_N to them before the call

start_vs_1, end_vs_1, start_vs_2, end_vs_2

TPoint

Start and End poses of each vision system

g_trajectory_size, g_trajectory_counter, g_operation_counter

int[], int, int

Number of waypoints per trajectory segment and internal counters used during the pick

g_pho_req_type, g_pho_new_req, g_pho_req_finished, g_is_thread_mov, g_trajectory_type_is_fine

int, bool

Handshake between the MAIN PROGRAM and the backend thread (see section 3.6)

Trajectory waypoints are not stored in point variables. The backend writes them (joint values in degrees, one waypoint per line) to the file trajectory.txt on the controller and deletes the file after the pick.

3.5 Error codes

Every request procedure returns the error code from the vision controller (0 = no error). The module defines the constants below for readability. For the meaning of each code and how to fix it, see Error codes.

Constant

Code

Meaning

OK

0

No error

SERVICE_ERR

1

Service error

COM_FAILURE

3

Communication error

BAD_DATA

4

Bad data

LONG_TRAJ

6

Trajectory too long

BRAND_ERR

7

Brand does not match

SIMUL_M_ERR

8

Bin picking in simulation mode

CONN_DROP

9

Connection dropped

TERMINATED

10

Terminated

PLAN_FAILED

201

Path planning failed

NO_PART_FOUND

202

No object found

NOT_INITIALIZED

203

Vision system not initialized

EMPTY_SCENE

218

Empty scene

UNKNOWN_STATE

219

Unable to read vision system pose

SCENE_NOT_ACTIVE

220

Scene state not found

SCENE_ACTIVE

221

Scene state already active

WRONG_BP_CONFIG

255

Wrong bin picking configuration

UNKNOWN_ERR

400

Unknown error

INVALID_SOL

450

Invalid solution ID

ANOTHER_SOL

451

Another solution running

SOL_START_ER

452

Deployment not started

SOL_NOT_RUN

453

Deployment is not running

SOL_STOP_ERR

454

Deployment did not stop

SOL_INCOMPL

455

Solution is not complete

INVAL_BRAND

457

Invalid robot brand

SOL_RUNNING

458

Solution already running

SOL_FORBID

459

Solution access unauthorized

INVALID_VS

460

Invalid vision system

CALIB_RUNN

461

Calibration is already running

CALIB_N_RUNN

462

Calibration is not running

CALIB_STOP_E

463

Calibration could not be stopped

CALIB_STRT_E

464

Calibration could not be started

CALIB_DISABL

465

Automatic calibration is disabled

NOT_ENOUGH_P

466

Not enough calibration points

NOT_ENOUGH_A

467

Calibration accuracy is above the allowed threshold

SCANNER_NA

468

Scanner not available

CALIB_FORBID

469

Calibration not allowed

Codes without a constant can also be returned. For example, bbox_change() returns 222 (Invalid bounding box) if the bounding box ID does not exist.

Error handling in the module:

  • The connection to the vision controller is opened once, when the backend thread starts (ThreadRun(bin_picking_backend(), False) at the top of MAIN PROGRAM). Each socket read waits up to 10 s.

  • Request errors are only returned. The MAIN PROGRAM decides what to do (the example programs show the code with Display() and then retry or stop).

  • Corrupted trajectory data stop the script with a message on the display: PHOCLIENT: Recvd ID ... Exptd ID (unexpected response), PHOCLIENT: Trajectory too long (more than 100 waypoints in one segment), PHOCLIENT: Point ID Error and PHOCLIENT: Checksum Error.

  • If the vision controller is restarted or the cable is disconnected, stop and restart the script to reconnect.

3.6 Bin Picking Procedures

A bin picking cycle consists of scan_request(), trajectory_request() and the Pick, which executes the received trajectory. The Pick is an internal request with ID 200 (constant PICK). It is not sent to the vision controller. It synchronizes the two threads of the script:

  1. The MAIN PROGRAM moves the robot to the start pose, sets g_pho_req_type = PICK and g_pho_new_req = 1.

  2. The backend thread goes through the operations of the received trajectory in order. For a trajectory segment, it sets g_trajectory_type_is_fine and g_is_thread_mov = True and waits. For a gripper operation, it calls the gripper procedure itself (gripper procedures are simple IO and are allowed in the thread).

  3. The MAIN PROGRAM waits for g_is_thread_mov and calls execute_trajectory_segment(g_trajectory_type_is_fine), then resets g_is_thread_mov = false.

  4. When all operations are done, the backend sets g_pho_req_finished = 1. The MAIN PROGRAM resets it to 0 and continues with placing.

Motion commands run only in the MAIN PROGRAM. Copy this loop unchanged from the example programs.

The table below gives an overview of the bin picking procedures in the customer definitions section of the script.

Procedure

Description

execute_trajectory_segment(bool is_fine)

Description: Executes one bin picking trajectory segment. It reads the waypoints of the current segment from trajectory.txt and moves through them with PTP("JPP", ...). Do not change the logic of this procedure, but you can change the speed and blending settings.

Input Parameters: is_fine - type of the segment as sent by the vision controller (see Trajectory request): segment type 0 = continuous, segment type 1 = fine. If is_fine is true, the robot stops at the last waypoint of the segment (QueueTag) before the next operation starts. If false, the robot continues to the next segment without stopping.

The global variable g_trajectory_size holds the number of waypoints of each segment. g_trajectory_counter holds the number of segments already executed.

Speed control: see section 3.7.

gripper_attach()

Description: User procedure, typically used to grip the object at the Grasp waypoint. The shipped version is an example that you must adapt: it sets IO["ControlBox"].DO[0] = 1 and waits 500 ms.

Usage: Called by the backend when the trajectory contains the Attach gripper operation (configured on the Grasping method page of the Studio).

gripper_detach()

Description: User procedure used to release the object. The shipped version is an example that you must adapt: it sets IO["ControlBox"].DO[0] = 0.

Usage: Called by the backend when the trajectory contains the Detach gripper operation. The examples also call it directly in the placing sequence.

gripper_user_1()

Description: Empty user procedure. Customize it for your specific operations.

Usage: Called by the backend when the trajectory contains the User 1 gripper operation.

gripper_user_2()

Description: Empty user procedure. Customize it for your specific operations.

Usage: Called by the backend when the trajectory contains the User 2 gripper operation.

gripper_user_3()

Description: Empty user procedure. Customize it for your specific operations.

Usage: Called by the backend when the trajectory contains the User 3 gripper operation.

3.7 Bin Picking Speed and Blending Settings

Bin Picking Studio supports up to 10 trajectory segments in one bin picking trajectory. The default number of segments is 4. If needed, you can add more segments on the Grasping method page of the BPS solution.

To adjust the speed and smoothness of the robot for a specific segment, use the arrays at the beginning of the execute_trajectory_segment procedure:

  • ROBOT_END_MOVING_SPEED_ARR: Controls the velocity.

  • TIME_INTERVAL_ACCEL_ARR: Controls the acceleration time in milliseconds.

  • BLENDING_VALUE_ARR: Controls the blending between points (0–100%).

  • CONTINUOUS_ARR: Boolean (True/False) to enable or disable continuous point transfer.

To change the speed of a segment, change the matching value in the array. For example, to make the “Start to Approach” segment faster, increase the first value in ROBOT_END_MOVING_SPEED_ARR and decrease the first value in TIME_INTERVAL_ACCEL_ARR.

To make the “Approach to Grasp” segment slower, decrease the second value in ROBOT_END_MOVING_SPEED_ARR and increase the second value in TIME_INTERVAL_ACCEL_ARR.

Figure 25
Figure 26

Note

If the robot moves jerkily during the trajectory execution, try different values of these settings.

3.8 Example Programs

The Photoneo Techman module contains several example programs. They show how to use the requests from section 3.2 in different use cases. Each file contains only a MAIN PROGRAM block. Paste it over the MAIN PROGRAM block of photoneo_main_bps.script (see section 2.9).

Program Example

Description

photoneo_basic photoneo_hand_eye

Shows the basic workflow: initialize the system, send a scan request, request a trajectory, receive the trajectory as joint waypoints and execute the motion. The example also shows error handling: each function returns an error value, which is assigned to g_error_code. photoneo_hand_eye does the same for a hand-eye (robot-mounted) vision system: it moves to the scan pose and switches the TCP to RobotEndFlange before each scan. Note: Make sure that the Start and End poses are configured as described in section 4.1.

photoneo_automatic_recalibration

Basic calibration example. Requirements: The user must start and confirm the first calibration of the vision system manually in Bin Picking Studio. Automatic recalibration must be enabled for the vision system. Calibration Steps

  1. Teach All 9 Calibration Poses

    • The example contains 9 calibration points C001 - C009 taught on a TM12S. Adjust them for your cell.

    • You can also add points to the calibration table manually: click “Add Calibration Point” in Bin Picking Studio (BPS).

  2. Calibration Sequence

    • calib_start(solution_id, vision_system_id) starts the calibration. The robot then moves to each point and calls calib_add().

    • calib_save() calculates and saves the result. The accuracy is stored in g_calib_err (mm) and the calibration pose in cal_pose_cart.

    • calib_stop() ends the calibration.

    • The TCP is switched to RobotEndFlange before the calibration starts.

  3. Calibration Accuracy

    • As a general rule, the calibration error should be below 3 mm.

    • A higher error usually means a systematic problem in the calibration setup.

Important: The calibration object must stay where it was during the first calibration. The calibration ball stays mounted in the same place on the flange or gripper and moves with the robot. The marker pattern stays in the same place in the cell. Otherwise, the automatic recalibration fails.

photoneo_multiple_vision_systems

Same as photoneo_basic, but switches between two vision systems. The vision_system_id variable selects which vision system is activated or queried for trajectory data. Both vision systems are initialized with their own Start and End poses. The switching is at the bottom of the MAIN PROGRAM section.

photoneo_change_environment

Same as photoneo_basic, but switches between two environment states. It uses the environment_change() request to activate the required environment. The environment_id variable selects the environment state for the next switch. The switching logic is at the bottom of the MAIN PROGRAM section.

photoneo_change_bbox

Same as photoneo_basic, but switches between two bounding boxes of VS1 after each cycle with bbox_change(vision_system_id, bbox_id). Both bounding boxes (bbox_id_1, bbox_id_2) must be defined in the solution.

photoneo_change_solution

Same as photoneo_basic, but uses all requests for solution switching. It stops the running solution with solution_stop(), starts the first one with solution_start(), reads the running solution with get_running_sol() and switches solutions with solution_change(). The solution_id variable selects the solution. The switching logic is at the bottom of the MAIN PROGRAM section.

photoneo_get_object_pose

Similar to photoneo_basic, but instead of a trajectory, the robot gets the Cartesian pose of the object with get_object_pose(vision_system_id, 0, 0, 100). This is useful for applications such as pick verification, slip sheet detection and basic picking. Note: The system returns the raw Cartesian pose from the localization. The STL file of the object defines the origin. No gripping points or invariance transformations are applied. The result is stored in obj_pose_cart. obj_pose_cart_approach is the same pose shifted by the approach offsets (here 100 mm in Z of the robot base).

photoneo_get_status

Same as photoneo_basic, but calls get_status several times. You can call get_status() repeatedly at short intervals during the localization. Returned values: g_num_of_localized: Number of objects localized g_num_of_planned: Number of objects ready for picking g_vs_status: Current state of the vision system (0 = finished, 1 = running) These variables are often used for advanced decisions, for example to find the best time to start the pick.

photoneo_multiview_static

Static Meshing example. Shows how to stitch multiple scans before the localization starts. This is useful for complex scenes or large objects. In the static approach, the robot stops at each scanning position to trigger and capture a scan. Procedure

  1. Scanning Setup:

    • Set g_mesh_dynamic = 0. The robot must stop at each scanning position to trigger and capture a scan.

  2. Meshing Process:

    • Move through all scanning poses and call capture_request() in each of them.

  3. Starting Localization:

    • After the capture sequence, start the localization with a regular scan_request(). This request does not perform a real scan and does not emit light. It only starts the localization.

  4. Scan Limit:

    • Keep the total number of scans below 10 for the best system performance.

photoneo_multiview_dynamic

Dynamic Meshing example. This setup uses the Photoneo Instant Meshing technology in BPS together with the Parallel Structured Light technology of the MotionCam-3D. Dynamic Meshing does not work with standard PhoXi 3D Scanners. Requirements

  • g_mesh_dynamic: Must be set to 1 to enable Dynamic Meshing mode (it is an integer, 0 = static).

  • g_capture_gap: Approximately 500 ms is recommended. It limits the scanning frequency and prevents system overload.

Procedure

  1. Start Capturing:

    • Move to the first meshing waypoint and call capture_request(). With g_mesh_dynamic = 1, the procedure returns immediately and the backend keeps sending captures every g_capture_gap ms while the robot moves through the meshing waypoints.

  2. Initial Scan Position:

    • The robot position during the first scan is critical for the correct orientation of the final point cloud. Therefore, the robot must not move until the first scan is received.

  3. Stop Capturing:

    • Set g_mesh_dynamic = 0, then wait for g_pho_req_finished == 1 and reset it to 0 (the backend finishes the last capture).

  4. Scanning Sequence:

    • After the capture sequence, start the localization with a regular scan_request(). This request does not perform a real scan.

    • This scan does not emit light. It only starts the localization.

  5. Scanning Trajectory and View:

    • Make the scanning trajectory smooth, without abrupt rotations. Keep the scanned area in the field of view so that the tracking is not lost.

  6. Scan Limit:

    • Do not use more than 60 scans in total, for the best performance.

photoneo_reuse_scan

Same as the photoneo_multiple_vision_systems example, but adds the BPS feature reuse_scan_request(vision_system_id). This request is useful when the scene has not changed since the last scan, but you need to run the localization again with a different configuration. For example, to search for different objects, use different bounding boxes or apply different settings. Procedure

  1. Initial Scan:

    • Perform a regular scan for VS1 to capture the scene.

  2. Reusing Scans:

    • For VS2, call reuse_scan_request(vision_system_id) to reuse the scan data from VS1. This lets you repeat the localization with a different configuration without a new scan.

The MAIN PROGRAM of photoneo_basic.script (the default MAIN PROGRAM of photoneo_main_bps.script is the same sequence):

main
{
    int error_code
    int solution_id
    int vision_system_id
    int environment_id
    int bbox_id

    // Start bin picking backend communication thread
    ThreadRun(bin_picking_backend() , False)

    // Initial Scan Position/Recovery Path
    PTP("JPP", Point["scan"].Joint, 100, 200, 100, false)
    QueueTag(1, 1) //Wait for robot movement

    // Send Initialize Request for VS1
    vision_system_id = 1
    start = start_vs_1   // copy start pose to global var
    end = end_vs_1       // copy end pose to global var
    error_code = init_request(vision_system_id)
    if(error_code != 0){
        Display("PHOCLIENT: Init Error: " + error_code)
        WaitFor(10000)
        Exit()
    }

    //-----------------------------------------------------
    // Main Loop
    //-----------------------------------------------------
    while (1)
    {
        // Send Scan Request
        vision_system_id = 1
        error_code = scan_request(vision_system_id)
        if(error_code != 0){
            Display("PHOCLIENT: Scan Error: " + error_code)
            WaitFor(10000)
            Exit()
        }

        // Send Trajectory Request
        error_code = trajectory_request(vision_system_id)

        // If no error proceed to bin picking
        if (error_code == 0){

            // Move to Start Point (Fine)
            PTP("JPP", Point["start"].Joint, 100, 200, 100, false)
            QueueTag(1, 1)

            // Initiate pick procedure signaling backend to prepare buffers
            g_pho_req_type = PICK
            g_pho_new_req = 1

            // Main thread execution loop for full trajectory
            // Iterate through operations until backend signals finished
            while(g_pho_req_finished == 0) {
                // Wait for either thread movement request OR gripper action OR request finish
                WaitFor(g_is_thread_mov == True || g_pho_req_finished == 1, -1)
                // If pick request finished, break the loop
                if (g_pho_req_finished == 1) {
                    break
                }
                // Call execute_trajectory_segment to execute movements
                if (g_is_thread_mov == True) {
                    // Execute the requested trajectory segment
                    execute_trajectory_segment(g_trajectory_type_is_fine)
                    // Reset flag to signal backend we finished this segment
                    g_is_thread_mov = false
                }
            }
            // Notify backend thread that pick request has finished
            g_pho_req_finished = 0

            // Placing
            Line("CPP", Point["drop_up"].Value, 50, 200, 100, false)
            Line("CPP", Point["drop_down"].Value, 50, 200, 100, false)
            QueueTag(1, 1) //Wait for robot movement to complete
            gripper_detach()
            Line("CPP", Point["drop_up"].Value, 50, 200, 100, false)
            QueueTag(1, 1) //Wait for robot movement to complete

        }// ENDIF - no trajectory error
    } // ENDWHILE - main loop
} // ENDMAIN - program

4. Runtime

When the solution is fully configured on the vision controller, finish the remaining steps on the robot side and run the bin picking program.

4.1 Teach Positions

After you open photoneo_main_bps.script or another example program, touch up a few local poses before you run the program. See the TPoint declarations below:

Figure 27

Besides the 3 local poses scan, drop_up and drop_down, you must also define the Start and End poses for all vision systems in the current solution. These poses define the first and the last trajectory waypoint, and the Initialize request needs them for each vision system. Usually, the Start and End poses are taught with the robot tool above the center of the bin.

The easiest way to touch up poses in TMscript: jog the robot to the required pose and press the Point/Target 🞋 button on the robot flange. This creates a new TPoint variable at the end of the define section of your script and records the point. From there, copy the joint or Cartesian values to the main poses.

4.2 Gripper Commands

The gripper procedures are at the end of photoneo_main_bps.script (CUSTOMER DEFINITIONS section). gripper_attach() and gripper_detach() contain only an example (IO["ControlBox"].DO[0] set to 1 / 0, attach waits 500 ms). gripper_user_1() - gripper_user_3() are empty. Add the IO commands for your gripper operations.

Figure 29

On the Grasping Methods page of Bin Picking Studio, you can set a gripper command for each major waypoint of the bin picking trajectory. For example, if the Attach procedure is set at the Grasp waypoint, the trajectory contains an Attach gripper operation after the segment that ends at the Grasp waypoint. During the Pick (request 200, see section 3.6), the backend thread calls gripper_attach() when it reaches this operation.

Figure 30

4.3 Runtime Prerequisites

Do a final check before you start the bin picking program on the robot.

Make sure that:

  • The bin picking solution is correctly configured on the vision controller.

  • The network setup on the robot side is complete and the Robot State Server works.

  • All vision systems in the solution are calibrated.

  • The Start and End poses of all vision systems are touched up.

  • All local poses in the main program are touched up.

  • The gripper procedures are ready and working.

4.4 Running the photoneo_main_bps Script

Deploy your solution. Until the communication is established, the Deployment page shows the Action Request Client (Robot) status as DISCONNECTED.

Figure 31

Note

Before you run the program for the first time, we strongly recommend that you decrease the override speed to 5%.

Figure 32

When the connection is established, the Action Request Client and Robot State Server status changes to CONNECTED. The sensor should then capture the first scan, and the localization should start.

If there is a pickable object in the scene and the robot controller has received the trajectory for it, the robot should start moving towards the object.

Figure 33

If everything looks fine, let the robot continue towards the first object and check that the path is correct. If the robot stops too far from the object or pushes it too deep, make changes on the Tool Point or Gripping Point page of Bin Picking Studio.

If the trajectories look fine, set up your own placing routine and slowly increase the speed back to 100%.

Figure 34

You have successfully deployed the Photoneo Techman Robot module. You can now improve your application further. Use the cheat sheet and the example programs as a guide.

5. Version and Brand ID

Item

Value

Robot module version

1.12.0 (Bin Picking Studio 1.12)

Brand ID sent after connecting

TECHMAN_ROBOT/1.12.0XXXX

Action Request Server port

11003 (PHOTONEO_PORT_NUM)

Robot State Server

TCP port 11004, TMCraft service TMserver_PHO_8ABBA73E

The backend thread sends the brand ID right after it opens the socket (brand_msg in bin_picking_backend()). Do not change it. The supported features of all Robot modules are listed in the Robot module support matrix.

6. Migration

The Techman BPS module was first released for Bin Picking Studio 1.11. Version 1.12 changes how Info data are received (one value per key, see section 3.3). It also adds the Info data variables g_dim_x, g_dim_y, g_rot_z, g_nn_label, g_max_z_height and g_tilt and updates the brand ID. To upgrade, replace the whole backend part of your script with the backend from the new photoneo_main_bps.script. Keep your MAIN PROGRAM and gripper procedures.

See Migration guide 1.11.x to 1.12.x for details.